const joi = require("joi");

const id = joi.number().integer().required();
const student_id = joi.string().min(1).max(10).required();
const password = joi
  .string()
  .pattern(/^[\S]{6,12}$/)
  .required();

const grade = joi.string().required();
const classNum = joi.string().required();
const avatar = joi.string().dataUri();

const security = joi.string().required();
const answer = joi.string().max(26).required();

// 注册校验
exports.user_reg = {
  body: {
    student_id,
    password,
    grade,
    class: classNum,
    security,
    answer,
    avatar,
  },
};

// 登录校验
exports.user_login = {
  body: {
    student_id,
    password,
  },
};

// 重置密码校验
exports.user_reset = {
  body: {
    student_id,
    password,
    passwordAgain: joi.ref("password"),
    security,
    answer,
  },
};

// 修改头像校验
exports.user_updateAvatar = {
  body: {
  },
};
